package com.qf.test.test.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 演示跨域访问问题和解决方案
 */
@Controller
@RequestMapping("/origin")
//解决跨域访问问题
@CrossOrigin("http://localhost:8081")  //循序来自8081服务器发来的请求

public class CrossController {
    /**
     * 跨域访问方法
     */
    @RequestMapping("test1")
    @ResponseBody
    public String test1(){
        System.out.println("访问到了跨域的controller方法");
        return "ok";
    }
}
